<template>
  <div class="header">
    <!-- 莱特妮丝定制 start -->
    <div class="info2" v-if="ltsn_dz">
      <div class="ltsn fontGilroy">
        <div>
          <span>{{headerData.all_order_amount}}</span>
          <p>订单总金额(元)</p>
        </div>
      </div>
    </div>
    <!-- 莱特妮丝定制 end -->
    <div class="info2" v-else>
      <div class="other fontGilroy">
        <div>
          <span>{{headerData.settle_commission}}</span>
          <p>已结算销售奖(元)</p>
        </div>
        <div>
          <span>{{headerData.all_order_amount}}</span>
          <p>订单总金额(元)</p>
        </div>
      </div>
    </div>
    
    <!-- 代理商 -->
    <section class="tab-item" v-if="type=='dls'">
      <div @click="selectItem('dlsRecommend')" :class="['item',headerData.type == 0 ? 'cur':'']">
        <p class="num fontGilroy">{{headerData.dls_num || 0}}</p>
        <span class="name">推荐列表</span>
        <i></i>
      </div>
      <div @click="selectItem('dlsTeamHorizontalPush')" :class="['item',headerData.type == 2 ? 'cur':'']">
        <p class="num fontGilroy">{{headerData.dls_team_num || 0}}</p>
        <span class="name">团队平推</span>
        <i></i>
      </div>
      <div
        @click="selectItem('dlsSaleRewardOrder')"
        :class="['item',headerData.type == 1 ? 'cur':'']"
      >
        <p class="num fontGilroy">{{headerData.order_total || 0}}</p>
        <span class="name">销售奖订单</span>
        <i></i>
      </div>
    </section>
    <!-- 订货商 -->
    <section class="tab-item" v-if="type=='dhs'">
      <div @click="selectItem('dhsRecommend')" :class="['item',headerData.type == 0 ? 'cur':'']">
        <p class="num fontGilroy">{{headerData.dhs_num || 0}}</p>
        <span  class="name">推荐列表</span>
        <i></i>
      </div>
      <div
        @click="selectItem('dhsSaleRewardOrder')"
        :class="['item',headerData.type == 1 ? 'cur':'']"
      >
        <p class="num fontGilroy">{{headerData.order_total || 0}}</p>
        <span class="name">销售奖订单</span>
        <i></i>
      </div>
    </section>
  </div>
</template>

<script>
import Vue from 'vue'
export default Vue.extend({
  props: {
    type: {
      type: String,
      default: () => {
        return 'dls'
      }
    },
    headerData: {
      type: Object,
      default: () => {
        return {
          settle_commission: '',
          all_order_amount: '',
          dls_num: '',
          order_total: '',
          type: 0
        }
      }
    }
  },
  data() {
    return {
      // 莱特妮丝定制
      ltsn_dz: false
    }
  },
  methods: {
    selectItem(path) {
      // TODO 小程序跳转处理
        window.location.href = '/' + path
      
    }
  },
  created() {
    // 莱特妮丝定制
    const shop = this.$route.query.sid
    const ltsn_dz = this.$_shop('$_ltsn_dz', shop)
    this.ltsn_dz = ltsn_dz
  }
})
</script>

<style lang="scss">
@import 'src/styles/variables';
@import 'src/styles/mixin';
.header {
  .info2 {
    background: url('https://img.wifenxiao.com/h5-wfx/images/user/trader_bg.png') center/cover no-repeat;
    text-align: center;
    margin: 0 auto;
    color: $default;
    overflow: hidden;
    height: 210px;
    padding-top: 56px;
    box-sizing: border-box;
    span {
      display: block;
      font-size: 50px;
      font-weight: bold;
    }
    p {
      margin-top: 20px;
      font-size: 26px;
      color: #ffd9dd;
    }
    .other {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      &::before {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 1px;
        height: 80px;
        background-color: #ff7c86;
      }
      div {
        flex: 1;
      }
    }
    .ltsn {
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
    }
  }
  .tab-item {
    width: 100%;
    height: 135px;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    // overflow: hidden;
    .item {
      flex: 1;
      height: 100%;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      &.cur i {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        height: 6px;
        width: 96px;
        @include gradient(right, rgba(242, 11, 34, 1), rgba(242, 11, 34, 0.2));
      }
      .num {
        font-size: 32px;
        color: #f30c23;
        font-weight: bold;
        text-align: center;
      }
      .name {
        font-size: 24px;
        color: #666;
        margin-top: 18px;
        text-align: center;
      }
    }
  }
}
</style>